// Common functions
var eway = jQuery.extend({
	/**
	* Confirm before deleting an item
	* @argument: path to redirect to for deletion
	* @author: Nguyen Tuan Anh 
	*/
	confirm: function(path, text) {
		if (confirm(text)) {
			document.location = path;
		}
	},
	/**
	* Redirect a page to another location.
	* @argument: Path to redirect to.
	* @author: Nguyen Tuan Anh 
	*/
	redirect: function(path) {
		document.location = path;
	},
	/**
	* Display some information, and redirect the page to another location
	* @arguments:
	* 	redirect - TRUE if redirect is required, FALSE otherwise
	* 	path - New location to redirect to
	* 	text - Text to display
	* @author: Nguyen Tuan Anh
	*/
	info: function(redirect, path, text) {
		if (text) {
			alert(text);
		}
		
		if (redirect && path) {
			document.location = path;
		}
	},
	/**
	* Submit a form
	* @argument:
	* @author: Nguyen Tuan Anh
	*/
	submit: function(form, arguments) {
		if (!form) {
			return;
		}
		
		if ((arguments != null) && (arguments.length > 0)) {
			form.action += jQuery(arguments.val) + arguments.val;
		}
		
		form.submit();
	}
});

jQuery(document).ready(function() {
	// Fix PNG images error on IE6
	jQuery.ifixpng('../images/pixel.gif');
	jQuery('img[@src$=.png]').ifixpng();
});
